package com.sundaying.gooway.util;

import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class CallToHtml {
	/**
	 * 例如： http://localhost:8080/Gooway/toHtmlPath?fileName=index.jsp&&path=''&&toFileName=testa&&toPath=''
	 * @param fileName
	 * @param path
	 * @param toFilename
	 * @param toPath
	 */
	public static void callOnePage(String fileName, String path,
			String toFileName, String toPath) {
		try {
			String str = "http://localhost:8080/Gooway/toHtmlPath?fileName="
					+ fileName + "&&path=" + path + "&&toFileName=" + toFileName
					+ "&&toPath=" + toPath;
			int httpResult;
			URL url = new URL(str);
			URLConnection connection = url.openConnection();
			connection.connect();
			HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
			httpResult = httpURLConnection.getResponseCode();
			if (httpResult != HttpURLConnection.HTTP_OK) {
				System.out.println("没有连接成功");
			} else {
				System.out.println("连接成功了　");
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

}
